package com.kafka.demo.config.yml;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Map;


@Component
@ConfigurationProperties(prefix = "kafka-consumer")
public class KafkaConsumerProperties {

    private Map<String, ConsumerConfig> services;

    public Map<String, ConsumerConfig> getServices() {
        return services;
    }

    public void setServices(Map<String, ConsumerConfig> services) {
        this.services = services;
    }

    // 每个 consumer 的配置
    public static class ConsumerConfig {
        private String groupId;
        private int concurrency = 1;

        // getter and setter
        public String getGroupId() {
            return groupId;
        }

        public void setGroupId(String groupId) {
            this.groupId = groupId;
        }

        public int getConcurrency() {
            return concurrency;
        }

        public void setConcurrency(int concurrency) {
            this.concurrency = concurrency;
        }
    }
}